/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.ua.node;

import java.util.ArrayList;
import java.util.List;
import org.xml.sax.Attributes;
import org.xml.sax.helpers.AttributesImpl;

/**
 *
 * @author ananthaamornphong
 */
public class AttributeNode extends UMLNode {
    
    private String name = "";
    private String visibility = "public";

    private List nodes = new ArrayList();
    
   /* private StructuralFeatureMultiNode stnode = new StructuralFeatureMultiNode();
    private MultiplicityNode mcnode = new MultiplicityNode();
    private MultiplicityRangeNode mcrangenode = new MultiplicityRangeNode();
    private MultiplicityRange mcrange = new MultiplicityRange();
    private StructuralFeatureTypeNode sttypenode = new StructuralFeatureTypeNode();
    private DataTypeNode dtTypeNode = new DataTypeNode();
    
    */
    
    public void addNode(UMLNode node){
        nodes.add(node);
    }
    
    public void setName(String name){
        this.name = name;
    }
    
    @Override
    public String getName() {
        return "UML:Attribute";
    }

    @Override
    public List getChildren() {
        
    /*    mcrangenode.addNode(mcrange);
        mcnode.addNode(mcrangenode);
        stnode.addNode(mcnode);
        nodes.add(stnode);
        sttypenode.addNode(dtTypeNode);
        nodes.add(sttypenode);
     * 
     */
        return nodes;
    }

    @Override
    public int getChildCount() {
       return nodes.size();
    }

    @Override
    public org.xml.sax.Attributes getAttributes() {
        AttributesImpl attributes = new AttributesImpl();
        attributes.addAttribute("", "xmi.id", "", "", Long.toString(this.hashCode()));
        attributes.addAttribute("", "name", "", "", this.name);
        attributes.addAttribute("", "visibility", "", "", this.visibility);
        attributes.addAttribute("", "isSpecification", "","", "false");
        attributes.addAttribute("", "ownerScope", "","", "instance");
        attributes.addAttribute("", "changeability", "","", "changeable");
        attributes.addAttribute("", "targetscope", "","", "instance");
        return attributes;
    }
    
}
